local log = function(s)
    local success, err = pcall(function() appendfile("log.txt", string.format("[%s] %s\n", os.date("%Y-%m-%d %H:%M:%S"), tostring(s))) end)
    if not success then
        print(string.format("[%s] %s\n", os.date("%Y-%m-%d %H:%M:%S"), tostring(err)))
        writefile("log.txt", string.format("[%s] %s\n", os.date("%Y-%m-%d %H:%M:%S"), tostring(s)))
    end
end
local HttpService = game:GetService("HttpService")
log("开始测试")
-- HTTP GET请求函数
function httpGet(url)
    return game:HttpGet(url, true)
end
-- HTTP POST请求函数
function httpPost(url, data)
    return game:HttpPost(url, data)
end
local function example_baidu_get()
    local url = "https://fifa-player.shopwegame.com/api/fifa/player/score?platform=ps"
    local success, response = pcall(function()
        local result = httpGet(url)
        log("请求URL: " .. url)
        log("响应长度: " .. tostring(#result) .. " 字符")
        result_d = HttpService:JSONDecode(result)
        log(result)
        -- log("sbc_task_id: " .. result_d.data[1]["sbc_task_id"])
        -- 显示前500个字符作为预览
        local preview = string.sub(result, 1, 100)
        log("响应预览:\n" .. preview .. "...")
        return result
    end)
    if not success then
        log("请求失败: " .. tostring(response))
    end
end

example_baidu_get()

